package com.etc.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.etc.entity.AsType;
import com.etc.service.IAsTypeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 类型管理Controller
 * 
 * @author ruoyi
 * @date 2022-11-27
 */
@RestController
@RequestMapping("/type")
public class AsTypeController
{
    @Autowired
    private IAsTypeService asTypeService;

    /**
     * 查询类型管理列表
     */

    @GetMapping("/list")
    public List<AsType> list(AsType asType)
    {

        List<AsType> list = asTypeService.selectAsTypeList(asType);
        return list;
    }

    /**
     * 导出类型管理列表
     */


    @PostMapping("/export")
    public void export(HttpServletResponse response, AsType asType) throws IOException {
        List<AsType> list = asTypeService.selectAsTypeList(asType);
        ExcelUtil<AsType> util = new ExcelUtil<AsType>(AsType.class);
        util.exportExcel(response, list, "类型管理数据");
    }

    /**
     * 获取类型管理详细信息
     */

    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(asTypeService.selectAsTypeById(id));
    }

    /**
     * 新增类型管理
     */


    @PostMapping
    public AjaxResult add(@RequestBody AsType asType)
    {
        return AjaxResult.success();
    }

    /**
     * 修改类型管理
     */


    @PutMapping
    public AjaxResult edit(@RequestBody AsType asType)
    {
        return AjaxResult.success();
    }

    /**
     * 删除类型管理
     */


	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return AjaxResult.success();
    }
}
